<link href="<?php echo base_url('resources')?>/css/admin/styles.css" rel="stylesheet" type="text/css" />
<div id="PeopleTableContainer">
<form>
        Mã Hồ Sơ: 
        <select id="MaHoSo" name="MaHoSo">
            <option selected="selected" value="0">All</option>
            <?php
                for($i = 0; $i < count($result); $i++){
                    echo '<option value="'.$result[$i]->MaHoSo.'">'.$result[$i]->MaHoSo.'</option>';
                } 
            ?>
            
        </select>
        <button type="submit" id="LoadRecordsButton">Load records</button>
    </form>
<div id="TableContainer"></div>
<div> <br /></div>
<div class="addRecord">
    <form name="themluong" action="<?php echo base_url("/admin/chamcong/addExcel"); ?>" method="post" enctype="multipart/form-data">
        <input type="file" name="excel" accept="application/vnd.ms-excel" />&nbsp;&nbsp; &nbsp;
        <input type="submit" value="Lưu vào Database" />
    </form>
</div>
</div>
<div class="addRecord"></div>
<script type="text/javascript">

    $(document).ready(function() {

        //Prepare jTable
        $('#TableContainer').jtable({
            title: 'Danh sách chấm công',
            paging: true,
            pageSize: 25,
            pageSizeChangeArea: false,
            sorting: true,
            defaultSorting: 'MaChamCong DESC',
            actions: {
                listAction: '<?php echo base_url('admin/chamcong/get_danh_sach_cham_cong'); ?>',
                deleteAction: '<?php echo base_url('admin/chamcong/xoa_cham_cong'); ?>',
                createAction: '<?php echo base_url('admin/chamcong/them_cham_cong'); ?>',
                updateAction: '<?php echo base_url('admin/chamcong/update_cham_cong'); ?>',
            },
            fields: {
                MaChamCong: {
                    key: true,
                    create: false,
                    edit: false,
                    list: true,
                    title: 'Mã Chấm Công',
                    width: '15%',
                },
                NgayLam: {
                    title: 'Ngày Làm',
                    width: '20%',
                    type: 'date'
                },
                GioVao: {
                    title: 'Giờ Vào',
                    width: '15%',
                    //type: 'time'
                },
                GioVe: {
                    title: 'Giờ Về',
                    width: '15%'

                },
                Cong: {
                    title: 'Công',
                    width: '20%'
                },
                MaHoSo: {
                    title: 'Mã Hồ Sơ',
                    width: '15%',
                    options: '<?php echo base_url("/admin/chamcong/maHoSo"); ?>',
                },
                
            },
        });

        //Load person list from server
        
        $('#LoadRecordsButton').click(function (e) {
            e.preventDefault();
            $('#TableContainer').jtable('load', {
                MaHoSo: $('#MaHoSo').val()
            });
        });
 
        //Load all records when page is first shown
        $('#LoadRecordsButton').click();
    s
        

    });



</script>